<?php
	if(isset($_GET['des']) && $_GET['des']!="" && isset($_GET['del']) && $_GET['del']!="")
	{
		$id = $_GET['del'];
		if($_GET['des']=="from")
		{			
			db_delete_item_price_by_id($id, "destination_from");
		}
		else if($_GET['des']=="to")
		{
			db_delete_item_price_by_id($id, "destination_to");
		}
		wp_redirect($urls);
	}

 $error = null;
 if(isset($_POST['des_from_submit']))
 {
 	if(intval($_SESSION['dest_hidden_code'])==intval($_POST['des_from_hidden_code']) && strlen($_POST['des_from_hidden_code'])>1)
 	{
 		db_insert_destination_from($_POST);
 		$error = "Insert Success!";
 	}
 	else 
 	{
 		$error = "Insert Failed!.";
 	}
 }
 else if(isset($_POST['des_to_submit']))
 { print_r($_POST['des_to_hidden_code']);
 	if(intval($_SESSION['dest_hidden_code'])==intval($_POST['des_to_hidden_code']) && strlen($_POST['des_to_hidden_code'])>1)
 	{
 		db_insert_destination_to($_POST);
 		$error = "Insert Success!";
 	}
 	else 
 	{
 		$error = "Insert Failed!.";
 	}
 	
 } 
 else if(isset($_POST['des_from_update']))
 {
 	db_update_destination_from($_POST);
 	$error = "Update Success!";
 }
  else if(isset($_POST['des_to_update']))
 {
 	db_update_destination_to($_POST);
 	$error = "Update Success!";
 }
 
 $hidden_code = rand(11111, 99999);
 $_SESSION['dest_hidden_code'] = $hidden_code;
?>